package yx1;

import java.util.Date;

public class program {
    public static void main(String[] args) {

        PrototypeManager<WeeklyLog> ob = new PrototypeManager<>();
        PrototypeManager<Attachment> at =new PrototypeManager<>();

        Attachment att = new Attachment();
        att.setName("我是谁附件");
        at.Set("Attachment",att);

        WeeklyLog wl = new WeeklyLog();
        wl.setAttachment(att);
        wl.setName("11");
        Date date=new Date();
        wl.setDate(date);
        wl.setContent("我做了什么");
        ob.Set("WeeklyLog1",wl);

//        Attachment a1 = at.Get("Attachment");
        WeeklyLog a = ob.Get("WeeklyLog1");

        System.out.println(a);
//        System.out.println(a1);

        WeeklyLog a11 = a.Clone();

        System.out.println(a.Clone());
//        System.out.println(a1.Clone());


        System.out.println("使用了new");
        if (a11.getName().equals(a.getName())){
            System.out.println("是同一个对象");
        }else {
            System.out.println("不是同一个对象");
        }
        System.out.println("没有使用了new");
        if (a11.getContent().equals(a.getContent())){
            System.out.println("是同一个对象");
        }else {
            System.out.println("不是同一个对象");
        }
    }
}
